import * as client from './client'
import urlConfig from './urlConfig'
/**
 * 获取销售网点优惠策略
 */

export class PolicyRst {
    //网点uid
    public salesOutletUID: string;
}


export class PolicyRpn {
    //优惠类型 1：无优惠；2：按比率优惠；3：满多少减多少（有上限）；4：满多少减多少（无上限）
    public discountType: number
    //是否支持快捷支付
    public supportQuickPay: boolean
    //使用优惠的最小订单金额
    public minSalesOrderAmountOfDiscount: number
    //优惠金额
    public discountAmount: number
    //最大优惠金额
    public maxDiscountAmount: number
    //优惠折扣
    public discountRatio: number
    //推送号码
    pushMobile: string[]
}

/**
 * 获取销售网点优惠策略
 */
export async function exec(rst: PolicyRst, userInfo: any) {
    const data = await client.exec(urlConfig.policy, rst, userInfo);
    return JSON.parse(data) as client.RSM<PolicyRpn>;
}